{include file="public/base"}
<style>
    td,th{text-align: center}
</style>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>订单管理</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>id</th>
                                <th>用户名</th>
                                <th>订单编号</th>
                                <th>商品图</th>
                                <th>商品名</th>
                                <th>商品规格</th>
                                <th>购买数量</th>
                                <th>订单金额</th>
                                <th>订单状态</th>
                                <th>收货人</th>
                                <th>收货地址</th>
                                <th>下单时间</th>
                                <th>支付时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach name="orderList" id="order"}
                            <tr>
                                <td>{$order['id']}</td>
                                <td>{$order['nickname']}</td>
                                <td>{$order['order_number']}</td>
                                <td><img src="{$order['small_img']}" style="width:50px;"></td>
                                <td>{$order['name']}</td>
                                <td>{$order['specification']}</td>
                                <td>{$order['number']}</td>
                                <td>{$order['price']}</td>
                                <td>{if $order['status']==0 }待支付{elseif $order['status']==1}已支付{elseif $order['status']==2}已发货{elseif $order['status']==3}已完成{elseif $order['status']==4}等待申诉{elseif $order['status']==5}申诉成功{elseif $order['status']==6}申诉驳回{/if}</td>
                                <td>{$order['area_name']}</td>
                                <td>{$order['area']}{$order['address']}</td>
                                <td>{$order['createtime']|date="Y-m-d H:i:s",###}</td>
                                <td>{$order['paytime']|date="Y-m-d H:i:s",###}</td>
                                <td>
                                    <a href="javascript:;" onclick="status({$order['id']},0,'同意')" class="btn btn-outline btn-info">同意</a>
                                    <a href="javascript:;" onclick="status({$order['id']},1,'驳回')" class="btn btn-outline btn-danger">驳回</a>
                                </td>
                            </tr>
                            {/foreach}
                            </tbody>
                        </table>
                        <div style="text-align: center;width: 100%;">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{block name="javascript"}
<script src="ADMIN_JS/plugins/peity/jquery.peity.min.js"></script>
<script src="ADMIN_JS/content.min.js?v=1.0.0"></script>
<script src="ADMIN_JS/plugins/iCheck/icheck.min.js"></script>
<script src="ADMIN_JS/demo/peity-demo.min.js"></script>
<script>
    //$(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    function status(id,ostate,xx){
        var box = layer.confirm("您确定要"+xx+"吗？",function(){
            var loading = layer.msg('正在提交数据，请稍后...', {icon: 16,time:6000});
            $.post('{:url("order/status")}',{'id':id,'status':ostate},function(data){
                layer.close(loading);
                if(data.code==1){
                    layer.msg(data.msg,{icon:1,time:2000});
                    setTimeout(function(){location.reload();},1500)
                }else{
                    layer.msg(data.msg,{icon:2,time:2000});
                }
            });
        });
    }
</script>
<script>
    function yanzheng(e,checks)
    {
        var checkboxs=document.getElementsByName(checks);
        for(i=0;i<checkboxs.length;i++)
        {
            checkboxs[i].checked=e.checked;
        }
    }
    function DelAll(){
        var id = new Array();
        var ids = $('[name="checkbox[]"]:checked');
        if(ids.length==0){
            layer.msg('请选择要删除的订单',{icon:2});
            return;
        }
        else{
            ids.each(function(){
                id.push($(this).val());//将选中的值添加到数组chk_value中
            })
        }
        var box = layer.confirm("您确定要删除吗？",function(){
            var loading = layer.msg('正在提交数据，请稍后...', {icon: 16,time:6000});
            $.post('{:url("order/orderDel")}',{id:id.join(',')},function(data){
                layer.close(loading);
                if(data.code=='1'){
                    layer.msg(data.msg,{icon:1,time:2000});
                    setTimeout(function(){location.reload();},1500)
                }else{
                    layer.msg(data.msg,{icon:2,time:2000});
                }
            });
        });
    }
</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
{/block}